//
//  TRTCLiveRoomIMAction.h
//  TRTCVoiceRoomOCDemo
//
//  Created by abyyxwang on 2020/7/8.
//  Copyright © 2020 tencent. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <ImSDK/ImSDK.h>
#import "TRTCLiveRoomDef.h"

NS_ASSUME_NONNULL_BEGIN

static NSString *trtcLiveRoomProtocolVersion = @"1.0.0";

typedef NS_ENUM(NSUInteger, TRTCLiveRoomIMActionType) {
    TRTCLiveRoomIMActionTypeUnknown = 0,
    
    TRTCLiveRoomIMActionTypeRequestJoinAnchor = 100, // 请求连麦
    TRTCLiveRoomIMActionTypeRespondJoinAnchor, // 应答
    TRTCLiveRoomIMActionTypeKickoutJoinAnchor, // 移除
    TRTCLiveRoomIMActionTypeNotifyJoinAnchorStream, //  103 
    TRTCLiveRoomIMActionTypeQuitJoinAnchor, // 主动结束连麦
    
    TRTCLiveRoomIMActionTypeKickOutAudience, // 踢出普通观众

    TRTCLiveRoomIMActionTypeRequestInviteAnchor = 200, // 邀请主讲人
    TRTCLiveRoomIMActionTypeRespondInviteAnchor, // 应答 接受 或者 拒绝
    TRTCLiveRoomIMActionTypeQuitInviteAnchor, // 主讲人主动退出
    TRTCLiveRoomIMActionTypeKickoutInviteAnchor, // 主讲人被动退出
    
    TRTCLiveRoomIMActionTypeRoomTextMsg = 300,
    TRTCLiveRoomIMActionTypeRoomCustomMsg,
    
    TRTCLiveRoomIMActionTypeUpdateGroupInfo = 400,
    
    TRTCLiveRoomIMActionTypeFeedbackInfo = 500, // 路演反馈
    
};



@class TRTCLiveUserInfo;
@class TRTCLiveRoomInfo;
@class TRTCCreateRoomParam;
typedef void(^LRIMCallback)(int code, NSString* message);
typedef void(^LREnterRoomCallback)(NSArray<TRTCLiveUserInfo *> *members, NSDictionary<NSString *, id> * customInfo, TRTCLiveRoomInfo * _Nullable roomInfo);
typedef void(^LRMemberCallback)(NSArray<TRTCLiveUserInfo *> *members);
typedef void(^LRRoomInfosCallback)(NSArray<TRTCLiveRoomInfo *> *roomInfos);

@interface TRTCLiveRoomIMAction : NSObject

+(BOOL)setupSDKWithSDKAppID:(int)sdkAppId listener:(id<V2TIMSDKListener>)listener;

+ (void)addMessageLister:(id<V2TIMAdvancedMsgListener, V2TIMGroupListener>)listener;

+ (void)releaseSdk;

+ (void)loginWithUserID:(NSString *)userID userSig:(NSString *)userSig callback:(LRIMCallback _Nullable)callback;

+ (void)logout:(LRIMCallback _Nullable)callback;

+ (void)setProfileWithName:(NSString *)name avatar:(NSString *)avatar callback:(LRIMCallback  _Nullable)callback;

+ (void)createRoomWithRoomID:(NSString *)roomID roomParam:(TRTCCreateRoomParam *)roomParam success:(LREnterRoomCallback _Nullable)success error:(LRIMCallback _Nullable)errorCallback;

+ (void)destroyRoomWithRoomID:(NSString *)roomID callback:(LRIMCallback _Nullable)callback;

+ (void)enterRoomWithRoomID:(NSString *)roomID success:(LREnterRoomCallback _Nullable)success error:(LRIMCallback _Nullable)errorCallback;

+ (void)exitRoomWithRoomID:(NSString *)roomID callback:(LRIMCallback _Nullable)callback;

+ (void)getRoomInfoWithRoomIds:(NSArray<NSString *> *)roomIds success:(LRRoomInfosCallback _Nullable)success error:(LRIMCallback _Nullable)error;

+ (void)getAllMembersWithRoomID:(NSString *)roomID success:(LRMemberCallback _Nullable)success error:(LRIMCallback _Nullable)error;

#pragma mark - Action Message
+ (void)requestJoinAnchorWithUserID:(NSString *)userID reason:(NSString *)reason callback:(LRIMCallback _Nullable)callback;

+ (void)respondJoinAnchorWithUserID:(NSString *)userID agreed:(BOOL)agreed reason:(NSString *)reason callback:(LRIMCallback _Nullable)callback;

+ (void)kickoutJoinAnchorWithUserID:(NSString *)userID callback:(LRIMCallback _Nullable)callback;

+ (void)notifyStreamToAnchorWithUserId:(NSString *)userID RoomID:(NSString *)roomID streamID:(NSString *)streamID callback:(LRIMCallback _Nullable)callback;

+ (void)quitJoinAnchorWithUserID:(NSString *)userID callback:(LRIMCallback _Nullable)callback;

+ (void)requestInviteAnchorWithUserID:(NSString *)userID callback:(LRIMCallback _Nullable)callback;

+ (void)respondInviteAnchorWithUserID:(NSString *)userID agreed:(BOOL)agreed callback:(LRIMCallback _Nullable)callback;

+ (void)quitInviteAnchorWithUserID:(NSString *)userID callback:(LRIMCallback _Nullable)callback;

+ (void)kickoutInviteAnchorWithUserID:(NSString *)userID callback:(LRIMCallback _Nullable)callback;

+ (void)feedbackInfoUserID:(NSString *)userID feedInfo:(TRTCLiveRoomFeedbackInfoType)feedInfo callback:(LRIMCallback _Nullable)callback;

+ (void)sendRoomTextMsgWithRoomID:(NSString *)roomID message:(NSString *)message callback:(LRIMCallback _Nullable)callback;

+ (void)sendRoomCustomMsgWithRoomID:(NSString *)roomID command:(NSString *)command message:(NSString *)message callback:(LRIMCallback _Nullable)callback;

+ (void)setGroupMemberMuteWithTime:(uint32_t)seconds userID:(NSString *)userID roomID:(NSString *)roomID callback:(LRIMCallback)callback;

+ (void)updateGroupInfoWithRoomID:(NSString *)roomID groupInfo:(NSDictionary<NSString *, id> *)groupInfo callback:(LRIMCallback _Nullable)callback;

+ (void)kickoutAudienceWithRoomID:(NSString *)roomID userID:(NSString *)userID callback:(LRIMCallback _Nullable)callback;

@end

NS_ASSUME_NONNULL_END
